unit convertercliente;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, DBTables, Grids, DBGrids, Gauges;

type
  TForm1 = class(TForm)
    DBGrid1: TDBGrid;
    DBGrid2: TDBGrid;
    dbclientes: TTable;
    dbfclientes: TTable;
    BatchMove1: TBatchMove;
    DataSource1: TDataSource;
    DataSource2: TDataSource;
    Button1: TButton;
    Button2: TButton;
    dbfclientesCLICODI: TSmallintField;
    dbfclientesCLINOME: TStringField;
    dbfclientesCLIFANT: TStringField;
    dbfclientesCLICGC_: TStringField;
    dbfclientesCLIENDE: TStringField;
    dbfclientesCLICIDA: TStringField;
    dbfclientesCLIUF__: TStringField;
    dbfclientesCLICEP_: TStringField;
    dbfclientesCLIFON1: TStringField;
    dbfclientesCLIFON2: TStringField;
    dbfclientesCLIFAX_: TStringField;
    dbfclientesCLICONT: TStringField;
    dbfclientesCLIHONO: TFloatField;
    dbfclientesCLIDIA_: TSmallintField;
    dbfclientesCLICF_D: TStringField;
    dbfclientesCONTA: TSmallintField;
    dbfclientesPARAMETRO: TFloatField;
    dbclientesCodigo: TSmallintField;
    dbclientesNome: TStringField;
    dbclientesFantasia: TStringField;
    dbclientesCnpj: TStringField;
    dbclientesCpf: TStringField;
    dbclientesEstadual: TStringField;
    dbclientesMunicipal: TStringField;
    dbclientesEndereco: TStringField;
    dbclientesCidade: TStringField;
    dbclientesUf: TStringField;
    dbclientesCep: TStringField;
    dbclientesFone1: TStringField;
    dbclientesFone2: TStringField;
    dbclientesFax: TStringField;
    dbclientesContato: TStringField;
    dbclientesWebsite: TStringField;
    dbclientesEmail: TStringField;
    dbclientesHonorario: TCurrencyField;
    dbclientesDia: TSmallintField;
    dbclientesSm: TIntegerField;
    dbclientesConta: TStringField;
    Gauge1: TGauge;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
mcodigo : integer;
begin
gauge1.visible := true;
gauge1.minvalue := 1;
gauge1.maxvalue := dbfclientes.RecordCount;
dbfclientes.First;
while not dbfclientes.eof do
 begin
 gauge1.Progress := gauge1.Progress + 1;
 mcodigo := dbfclientesclicodi.Value;
 if not dbclientes.FindKey([mcodigo]) then dbclientes.Append;
 if dbclientes.FindKey([mcodigo]) then dbclientes.edit;
 dbclientescodigo.Value    := dbfclientesclicodi.Value;
 dbclientesnome.Value      := dbfclientesclinome.Value;
 dbclientesfantasia.Value  := dbfclientesclifant.Value;
 dbclientescnpj.Value      := dbfclientesclicgc_.Value;
 dbclientescpf.Value       := '';
 dbclientesestadual.Value  := dbfclientesclicf_d.Value;
 dbclientesmunicipal.Value := '';
 dbclientesendereco.Value  := dbfclientescliende.Value;
 dbclientescidade.Value    := dbfclientesclicida.Value;
 dbclientesuf.Value        := dbfclientescliuf__.Value;
 dbclientescep.Value       := dbfclientesclicep_.Value;
 dbclientesfone1.Value     := dbfclientesclifon1.Value;
 dbclientesfone2.Value     := dbfclientesclifon2.Value;
 dbclientesfax.Value       := dbfclientesclifax_.Value;
 dbclientescontato.value   := dbfclientesclicont.value;
 dbclienteswebsite.Value   := '';
 dbclientesemail.value     := '';
 dbclienteshonorario.value := dbfclientesclihono.value;
 dbclientesdia.value       := dbfclientesclidia_.value;
 dbclientessm.value        := dbfclientesparametro.AsInteger;
 dbclientesconta.value     := dbfclientesconta.asstring;
 dbclientes.Post;
 dbfclientes.Next;
end;
gauge1.visible := false;
//gauge1.Refresh;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;

end.
